import re

def camel_to_snake_case(text):
    matches = re.finditer('[A-Z]', text)

    contents = []
    last_start = 0
    for it in matches:
        start, end = it.span()
        if start > 0:
            contents.append(text[last_start:start])

        last_start = start

    contents.append(text[last_start:])
    return '_'.join(contents).lower()


def snake_to_camel_first_lower(text):
    components = text.split('_')
    # We capitalize the first letter of each component except the first one
    # with the 'title' method and join them together.
    return components[0] + ''.join(x.title() for x in components[1:])


def snake_to_camel_case(text):
    components = text.split('_')
    return ''.join(x.title() for x in components[0:])


if __name__ == '__main__':
    import sys
    camel_text = sys.argv[1]
    snake_text = camel_to_snake_case(camel_text)

    print("{} => {}".format(camel_text, snake_text))
    print(camel_text.lower().replace('_', '') == snake_text.replace('_', ''))

    camelText = snake_to_camel_case("test_huzy_test_case")
    print(camelText)
